package com.zc.action;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.zc.dao.impl.ArticleDaoImpl;
import com.zc.model.Article;

public class ArticleDeleteAction extends ActionSupport implements ModelDriven<Article> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Article article = new Article();

	@Override
	public String execute() throws Exception {

		System.out.println("ArticleEdit输出articl的内容------------------" + article.toString());
		ArticleDaoImpl articleDao = new ArticleDaoImpl();
		if (articleDao.deleteArticle(article)) {
//			Map<String, Object> session = ActionContext.getContext().getSession();
//			session.remove("articles");
//			session.put("articles", articleDao.getAllArticle());
			return SUCCESS;
		} else {
			return ERROR;
		}

	}

	public Article getArticle() {
		return article;
	}

	public void setArticle(Article article) {
		this.article = article;
	}

	@Override
	public Article getModel() {
		return this.article;
	}

}
